<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Web::Simple - A quick and easy way to build simple web applications - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Web-Simple - MetaCPAN" href="https://metacpan.org/dist/Web-Simple/releases.rss" />
        <link rel="canonical" href="./Web::Simple.html" />
        <meta name="description" content="A quick and easy way to build simple web applications" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Web::Simple" />
<meta name="twitter:title"       content="Web::Simple" />
<meta name="twitter:description" content="A quick and easy way to build simple web applications" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Web::Simple.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Web-Simple was released.">
      <span class="relatize">20 Mar 2017 17:43:44 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Web-Simple">Web-Simple</a>
  </li>
  <li>
    Module version: 0.033
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Web-Simple/source/lib/Web/Simple.pm">Source</a>
    (<a href="https://metacpan.org/dist/Web-Simple/source/lib/Web/Simple.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Web-Simple/source/lib/Web">Browse</a>
    (<a href="https://metacpan.org/dist/Web-Simple/source/lib/Web?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Web-Simple/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Web-Simple/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Web-Simple.git">Repository</a>
          (<a rel="noopener nofollow" href="git://git.shadowcat.co.uk/catagits/Web-Simple.git">git clone</a>)
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=Web-Simple">Issues</a>
      (7)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Web-Simple+0.033" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Web-Simple.html?oncpan=1&amp;distmat=1&amp;version=0.033&amp;grade=2" style="color: #090">48</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Web-Simple.html?oncpan=1&amp;distmat=1&amp;version=0.033&amp;grade=3" style="color: #900">1</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Web-Simple.html?oncpan=1&amp;distmat=1&amp;version=0.033&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/MSTROUT/Web-Simple-0.033">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Web-Simple who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 8
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Web-Simple-0.033/index.html">79.60% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.6.0
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Web-Simple/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/M/MS/MSTROUT/Web-Simple-0.033.tar.gz">
      Download (<span itemprop="fileSize">52.84KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FMSTROUT%2FWeb-Simple-0.033%2Flib%2FWeb%2FSimple.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Web-Simple/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Web-Simple/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Web-Simple">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Web-Simple">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Web/Simple.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="MSTROUT/Web-Simple-0.033"
>0.033
  (MSTROUT on 2017-03-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.032"
>0.032
  (MSTROUT on 2016-11-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.031"
>0.031
  (MSTROUT on 2015-08-14)</option>
<option
  
  value="ETHER/Web-Simple-0.029"
>0.029
  (ETHER on 2014-07-27)</option>
<option
  
  value="APEIRON/Web-Simple-0.017"
>0.017
  (APEIRON on 2012-07-05)</option>
<option
  
  value="FREW/Web-Simple-0.004"
>0.004
  (FREW on 2010-07-08)</option>
<optgroup label="BackPAN">'
<option
  
  value="MSTROUT/Web-Simple-0.030"
>0.030
  (MSTROUT on 2014-08-07)</option>
<option
  
  value="ETHER/Web-Simple-0.028"
>0.028
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.027"
>0.027
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.026_001"
>0.026_001 DEV
  (ETHER on 2014-07-09)</option>
<option
  
  value="MSTROUT/Web-Simple-0.026"
>0.026
  (MSTROUT on 2014-07-09)</option>
<option
  
  value="ETHER/Web-Simple-0.025"
>0.025
  (ETHER on 2014-07-08)</option>
<option
  
  value="ETHER/Web-Simple-0.024"
>0.024
  (ETHER on 2014-07-04)</option>
<option
  
  value="MSTROUT/Web-Simple-0.023"
>0.023
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.022"
>0.022
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.021"
>0.021
  (MSTROUT on 2014-05-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.020"
>0.020
  (MSTROUT on 2012-08-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.019"
>0.019
  (MSTROUT on 2012-07-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.018"
>0.018
  (MSTROUT on 2012-07-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.016"
>0.016
  (MSTROUT on 2012-05-11)</option>
<option
  
  value="MSTROUT/Web-Simple-0.015"
>0.015
  (MSTROUT on 2012-05-10)</option>
<option
  
  value="MSTROUT/Web-Simple-0.014"
>0.014
  (MSTROUT on 2012-04-27)</option>
<option
  
  value="MSTROUT/Web-Simple-0.013"
>0.013
  (MSTROUT on 2012-04-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.012"
>0.012
  (MSTROUT on 2012-01-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.011"
>0.011
  (MSTROUT on 2011-12-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.010"
>0.010
  (MSTROUT on 2011-10-06)</option>
<option
  
  value="MSTROUT/Web-Simple-0.009"
>0.009
  (MSTROUT on 2011-10-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.008"
>0.008
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.007"
>0.007
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.006"
>0.006
  (MSTROUT on 2011-02-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.005"
>0.005
  (MSTROUT on 2011-01-11)</option>
<option
  
  value="FREW/Web-Simple-0.003"
>0.003
  (FREW on 2010-07-08)</option>
<option
  
  value="MSTROUT/Web-Simple-0.002"
>0.002
  (MSTROUT on 2009-12-01)</option>
<option
  
  value="MSTROUT/Web-Simple-0.001"
>0.001
  (MSTROUT on 2009-11-24)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/MSTROUT/Web-Simple-0.033/diff/' + encodeURIComponent(this.value) + '/lib/Web/Simple.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="MSTROUT/Web-Simple-0.033"
>0.033
  (MSTROUT on 2017-03-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.032"
>0.032
  (MSTROUT on 2016-11-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.031"
>0.031
  (MSTROUT on 2015-08-14)</option>
<option
  
  value="ETHER/Web-Simple-0.029"
>0.029
  (ETHER on 2014-07-27)</option>
<option
  
  value="APEIRON/Web-Simple-0.017"
>0.017
  (APEIRON on 2012-07-05)</option>
<option
  
  value="FREW/Web-Simple-0.004"
>0.004
  (FREW on 2010-07-08)</option>
<optgroup label="BackPAN">'
<option
  
  value="MSTROUT/Web-Simple-0.030"
>0.030
  (MSTROUT on 2014-08-07)</option>
<option
  
  value="ETHER/Web-Simple-0.028"
>0.028
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.027"
>0.027
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.026_001"
>0.026_001 DEV
  (ETHER on 2014-07-09)</option>
<option
  
  value="MSTROUT/Web-Simple-0.026"
>0.026
  (MSTROUT on 2014-07-09)</option>
<option
  
  value="ETHER/Web-Simple-0.025"
>0.025
  (ETHER on 2014-07-08)</option>
<option
  
  value="ETHER/Web-Simple-0.024"
>0.024
  (ETHER on 2014-07-04)</option>
<option
  
  value="MSTROUT/Web-Simple-0.023"
>0.023
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.022"
>0.022
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.021"
>0.021
  (MSTROUT on 2014-05-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.020"
>0.020
  (MSTROUT on 2012-08-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.019"
>0.019
  (MSTROUT on 2012-07-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.018"
>0.018
  (MSTROUT on 2012-07-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.016"
>0.016
  (MSTROUT on 2012-05-11)</option>
<option
  
  value="MSTROUT/Web-Simple-0.015"
>0.015
  (MSTROUT on 2012-05-10)</option>
<option
  
  value="MSTROUT/Web-Simple-0.014"
>0.014
  (MSTROUT on 2012-04-27)</option>
<option
  
  value="MSTROUT/Web-Simple-0.013"
>0.013
  (MSTROUT on 2012-04-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.012"
>0.012
  (MSTROUT on 2012-01-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.011"
>0.011
  (MSTROUT on 2011-12-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.010"
>0.010
  (MSTROUT on 2011-10-06)</option>
<option
  
  value="MSTROUT/Web-Simple-0.009"
>0.009
  (MSTROUT on 2011-10-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.008"
>0.008
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.007"
>0.007
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.006"
>0.006
  (MSTROUT on 2011-02-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.005"
>0.005
  (MSTROUT on 2011-01-11)</option>
<option
  
  value="FREW/Web-Simple-0.003"
>0.003
  (FREW on 2010-07-08)</option>
<option
  
  value="MSTROUT/Web-Simple-0.002"
>0.002
  (MSTROUT on 2009-12-01)</option>
<option
  
  value="MSTROUT/Web-Simple-0.001"
>0.001
  (MSTROUT on 2009-11-24)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Encode" title="Encode" class="ellipsis">Encode</a></li>
  <li><a href="https://metacpan.org/pod/Exporter" title="Exporter" class="ellipsis">Exporter</a></li>
  <li><a href="https://metacpan.org/pod/HTTP::Body" title="HTTP::Body" class="ellipsis">HTTP::Body</a></li>
  <li><a href="Moo.html" title="Moo" class="ellipsis">Moo</a></li>
  <li><a href="Plack.html" title="Plack" class="ellipsis">Plack</a></li>
  <li><a href="https://metacpan.org/pod/Scalar::Util" title="Scalar::Util" class="ellipsis">Scalar::Util</a></li>
  <li><a href="https://metacpan.org/pod/Syntax::Keyword::Gather" title="Syntax::Keyword::Gather" class="ellipsis">Syntax::Keyword::Gather</a></li>
  <li><a href="strictures.html" title="strictures" class="ellipsis">strictures</a></li>
  <li><a href="https://metacpan.org/pod/warnings::illegalproto" title="warnings::illegalproto" class="ellipsis">warnings::illegalproto</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Web::Simple/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Web%3A%3ASimple">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Web-Simple">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/MSTROUT/Web-Simple-0.033/view/lib/Web/Simple.pm">This version</a>
    </li>
    <li>
      <a href="./Web::Simple.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/GETTY"><img src="https://www.gravatar.com/avatar/d374f794bb2f39232c29d0b376b9dcc4?d=identicon&amp;s=20" title="GETTY" alt="GETTY"></a>
<a class="display-all" href="https://metacpan.org/author/JROBINSON"><img src="https://www.gravatar.com/avatar/c7254b939e5a5f293d8fabb51167fbaa?d=identicon&amp;s=20" title="JROBINSON" alt="JROBINSON"></a>
<a class="display-all" href="https://metacpan.org/author/MATEU"><img src="https://www.gravatar.com/avatar/312dfb94511960f0a4ded57d2c05755e?d=identicon&amp;s=20" title="MATEU" alt="MATEU"></a>
<a class="display-all" href="https://metacpan.org/author/RRWO"><img src="https://www.gravatar.com/avatar/4a5274bc5d690ee3d619f044778771a7?d=identicon&amp;s=20" title="RRWO" alt="RRWO"></a>
<a class="display-all" href="https://metacpan.org/author/ARJONES"><img src="https://www.gravatar.com/avatar/779fdd029141571e2650d9060978c1a1?d=identicon&amp;s=20" title="ARJONES" alt="ARJONES"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Web-Simple/plussers">19 PAUSE users</a>
</div>
<div>
    9 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-contrib-email="mst@shadowcat.co.uk"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      mst - Matt S. Trout (cpan:MSTROUT)
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/MSTROUT" class="author-name">Matt S Trout</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Web/Simple.pm&#39;" class="">
<option
  selected
  value="MSTROUT/Web-Simple-0.033"
>0.033
  (MSTROUT on 2017-03-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.032"
>0.032
  (MSTROUT on 2016-11-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.031"
>0.031
  (MSTROUT on 2015-08-14)</option>
<option
  
  value="ETHER/Web-Simple-0.029"
>0.029
  (ETHER on 2014-07-27)</option>
<option
  
  value="APEIRON/Web-Simple-0.017"
>0.017
  (APEIRON on 2012-07-05)</option>
<option
  
  value="FREW/Web-Simple-0.004"
>0.004
  (FREW on 2010-07-08)</option>
<optgroup label="BackPAN">'
<option
  
  value="MSTROUT/Web-Simple-0.030"
>0.030
  (MSTROUT on 2014-08-07)</option>
<option
  
  value="ETHER/Web-Simple-0.028"
>0.028
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.027"
>0.027
  (ETHER on 2014-07-11)</option>
<option
  
  value="ETHER/Web-Simple-0.026_001"
>0.026_001 DEV
  (ETHER on 2014-07-09)</option>
<option
  
  value="MSTROUT/Web-Simple-0.026"
>0.026
  (MSTROUT on 2014-07-09)</option>
<option
  
  value="ETHER/Web-Simple-0.025"
>0.025
  (ETHER on 2014-07-08)</option>
<option
  
  value="ETHER/Web-Simple-0.024"
>0.024
  (ETHER on 2014-07-04)</option>
<option
  
  value="MSTROUT/Web-Simple-0.023"
>0.023
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.022"
>0.022
  (MSTROUT on 2014-05-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.021"
>0.021
  (MSTROUT on 2014-05-20)</option>
<option
  
  value="MSTROUT/Web-Simple-0.020"
>0.020
  (MSTROUT on 2012-08-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.019"
>0.019
  (MSTROUT on 2012-07-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.018"
>0.018
  (MSTROUT on 2012-07-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.016"
>0.016
  (MSTROUT on 2012-05-11)</option>
<option
  
  value="MSTROUT/Web-Simple-0.015"
>0.015
  (MSTROUT on 2012-05-10)</option>
<option
  
  value="MSTROUT/Web-Simple-0.014"
>0.014
  (MSTROUT on 2012-04-27)</option>
<option
  
  value="MSTROUT/Web-Simple-0.013"
>0.013
  (MSTROUT on 2012-04-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.012"
>0.012
  (MSTROUT on 2012-01-30)</option>
<option
  
  value="MSTROUT/Web-Simple-0.011"
>0.011
  (MSTROUT on 2011-12-23)</option>
<option
  
  value="MSTROUT/Web-Simple-0.010"
>0.010
  (MSTROUT on 2011-10-06)</option>
<option
  
  value="MSTROUT/Web-Simple-0.009"
>0.009
  (MSTROUT on 2011-10-03)</option>
<option
  
  value="MSTROUT/Web-Simple-0.008"
>0.008
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.007"
>0.007
  (MSTROUT on 2011-02-16)</option>
<option
  
  value="MSTROUT/Web-Simple-0.006"
>0.006
  (MSTROUT on 2011-02-15)</option>
<option
  
  value="MSTROUT/Web-Simple-0.005"
>0.005
  (MSTROUT on 2011-01-11)</option>
<option
  
  value="FREW/Web-Simple-0.003"
>0.003
  (FREW on 2010-07-08)</option>
<option
  
  value="MSTROUT/Web-Simple-0.002"
>0.002
  (MSTROUT on 2009-12-01)</option>
<option
  
  value="MSTROUT/Web-Simple-0.001"
>0.001
  (MSTROUT on 2009-11-24)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Web-Simple">Web-Simple-0.033</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage two &#10;
          • 11 direct dependents &#10;          • 22 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Web-Simple-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Web-Simple-0.033">
    <input type="hidden" name="author" value="MSTROUT">
    <input type="hidden" name="distribution" value="Web-Simple">
    <button type="submit" class="favorite highlight"><span>28</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Web::Simple.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>28</span> ++</a>
</div>
   / <span>Web::Simple</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Web::Simple.html#NAME">NAME</a></li>
  <li><a href="./Web::Simple.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Web::Simple.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Web::Simple.html#DISPATCH-STRATEGY">DISPATCH STRATEGY</a>
    <ul>
      <li><a href="./Web::Simple.html#Examples">Examples</a></li>
      <li><a href="./Web::Simple.html#The-dispatch-cycle">The dispatch cycle</a></li>
      <li><a href="./Web::Simple.html#Web::Simple-match-specifications">Web::Simple match specifications</a>
        <ul>
          <li><a href="./Web::Simple.html#Method-matches">Method matches</a></li>
          <li><a href="./Web::Simple.html#Path-matches">Path matches</a>
            <ul>
              <li><a href="./Web::Simple.html#Naming-your-patch-matches">Naming your patch matches</a></li>
              <li><a href="./Web::Simple.html#/foo-and-/foo/-are-different-specs">/foo and /foo/ are different specs</a></li>
            </ul>
          </li>
          <li><a href="./Web::Simple.html#Extension-matches">Extension matches</a></li>
          <li><a href="./Web::Simple.html#Query-and-body-parameter-matches">Query and body parameter matches</a></li>
          <li><a href="./Web::Simple.html#Upload-matches">Upload matches</a></li>
          <li><a href="./Web::Simple.html#Combining-matches">Combining matches</a></li>
          <li><a href="./Web::Simple.html#Whitespace">Whitespace</a></li>
          <li><a href="./Web::Simple.html#Accessing-parameters-via-%25_">Accessing parameters via %_</a></li>
          <li><a href="./Web::Simple.html#Accessing-the-PSGI-env-hash">Accessing the PSGI env hash</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="./Web::Simple.html#EXPORTED-SUBROUTINES">EXPORTED SUBROUTINES</a>
    <ul>
      <li><a href="./Web::Simple.html#response_filter">response_filter</a></li>
      <li><a href="./Web::Simple.html#redispatch_to">redispatch_to</a></li>
    </ul>
  </li>
  <li><a href="./Web::Simple.html#CHANGES-BETWEEN-RELEASES">CHANGES BETWEEN RELEASES</a>
    <ul>
      <li><a href="./Web::Simple.html#Changes-between-0.004-and-0.005">Changes between 0.004 and 0.005</a></li>
      <li><a href="./Web::Simple.html#Changes-since-Antiquated-Perl">Changes since Antiquated Perl</a></li>
    </ul>
  </li>
  <li><a href="./Web::Simple.html#DEVELOPMENT-HISTORY">DEVELOPMENT HISTORY</a></li>
  <li><a href="./Web::Simple.html#COMMUNITY-AND-SUPPORT">COMMUNITY AND SUPPORT</a>
    <ul>
      <li><a href="./Web::Simple.html#IRC-channel">IRC channel</a></li>
      <li><a href="./Web::Simple.html#No-mailing-list-yet">No mailing list yet</a></li>
      <li><a href="./Web::Simple.html#Git-repository">Git repository</a></li>
    </ul>
  </li>
  <li><a href="./Web::Simple.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Web::Simple.html#CONTRIBUTORS">CONTRIBUTORS</a></li>
  <li><a href="./Web::Simple.html#COPYRIGHT">COPYRIGHT</a></li>
  <li><a href="./Web::Simple.html#LICENSE">LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Web::Simple - A quick and easy way to build simple web applications</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  #!/usr/bin/env perl

  package HelloWorld;
  use Web::Simple;

  sub dispatch_request {
    GET =&gt; sub {
      [ 200, [ &#39;Content-type&#39;, &#39;text/plain&#39; ], [ &#39;Hello world!&#39; ] ]
    },
    &#39;&#39; =&gt; sub {
      [ 405, [ &#39;Content-type&#39;, &#39;text/plain&#39; ], [ &#39;Method not allowed&#39; ] ]
    }
  }

  HelloWorld-&gt;run_if_script;</code></pre>

<p>If you save this file into your cgi-bin as <code>hello-world.cgi</code> and then visit:</p>

<pre><code>  http://my.server.name/cgi-bin/hello-world.cgi/</code></pre>

<p>you&#39;ll get the &quot;Hello world!&quot; string output to your browser. At the same time this file will also act as a class module, so you can save it as HelloWorld.pm and use it as-is in test scripts or other deployment mechanisms.</p>

<p>Note that you should retain the -&gt;run_if_script even if your app is a module, since this additionally makes it valid as a .psgi file, which can be extremely useful during development.</p>

<p>For more complex examples and non-CGI deployment, see <a href="https://metacpan.org/pod/distribution/Web-Simple/lib/Web/Simple/Deployment.pod">Web::Simple::Deployment</a>. To get help with <a href="./Web::Simple.html">Web::Simple</a>, please connect to the irc.perl.org IRC network and join #web-simple.</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The philosophy of <a href="./Web::Simple.html">Web::Simple</a> is to keep to an absolute bare minimum for everything. It is not designed to be used for large scale applications; the <a href="Catalyst.html">Catalyst</a> web framework already works very nicely for that and is a far more mature, well supported piece of software.</p>

<p>However, if you have an application that only does a couple of things, and want to not have to think about complexities of deployment, then <a href="./Web::Simple.html">Web::Simple</a> might be just the thing for you.</p>

<p>The only public interface the <a href="./Web::Simple.html">Web::Simple</a> module itself provides is an <code>import</code> based one:</p>

<pre><code>  use Web::Simple &#39;NameOfApplication&#39;;</code></pre>

<p>This sets up your package (in this case &quot;NameOfApplication&quot; is your package) so that it inherits from <a href="https://metacpan.org/pod/Web::Simple::Application">Web::Simple::Application</a> and imports <a href="strictures.html">strictures</a>, as well as installs a <code>PSGI_ENV</code> constant for convenience, as well as some other subroutines.</p>

<p>Importing <a href="strictures.html">strictures</a> will automatically make your code use the <code>strict</code> and <code>warnings</code> pragma, so you can skip the usual:</p>

<pre><code>  use strict;
  use warnings FATAL =&gt; &#39;all&#39;;</code></pre>

<p>provided you &#39;use Web::Simple&#39; at the top of the file. Note that we turn on *fatal* warnings so if you have any warnings at any point from the file that you did &#39;use Web::Simple&#39; in, then your application will die. This is, so far, considered a feature.</p>

<p>When we inherit from <a href="https://metacpan.org/pod/Web::Simple::Application">Web::Simple::Application</a> we also use <a href="Moo.html">Moo</a>, which is the the equivalent of:</p>

<pre><code>  {
    package NameOfApplication;
    use Moo;
    extends &#39;Web::Simple::Application&#39;;
  }</code></pre>

<p>So you can use <a href="Moo.html">Moo</a> features in your application, such as creating attributes using the <code>has</code> subroutine, etc. Please see the documentation for <a href="Moo.html">Moo</a> for more information.</p>

<p>It also exports the following subroutines for use in dispatchers:</p>

<pre><code>  response_filter { ... };

  redispatch_to &#39;/somewhere&#39;;</code></pre>

<p>Finally, import sets</p>

<pre><code>  $INC{&quot;NameOfApplication.pm&quot;} = &#39;Set by &quot;use Web::Simple;&quot; invocation&#39;;</code></pre>

<p>so that perl will not attempt to load the application again even if</p>

<pre><code>  require NameOfApplication;</code></pre>

<p>is encountered in other code.</p>

<p>One important thing to remember when using</p>

<pre><code>  NameOfApplication-&gt;run_if_script;</code></pre>

<p>At the end of your app is that this call will create an instance of your app for you automatically, regardless of context. An easier way to think of this would be if the method were more verbosely named</p>

<pre><code> NameOfApplication-&gt;run_request_if_script_else_turn_coderef_for_psgi;</code></pre>

<h1 id="DISPATCH-STRATEGY"><a id="DISPATCH"></a>DISPATCH STRATEGY</h1>

<p><a href="./Web::Simple.html">Web::Simple</a> despite being straightforward to use, has a powerful system for matching all sorts of incoming URLs to one or more subroutines. These subroutines can be simple actions to take for a given URL, or something more complicated, including entire <a href="Plack.html">Plack</a> applications, <a href="https://metacpan.org/pod/Plack::Middleware">Plack::Middleware</a> and nested subdispatchers.</p>

<h2 id="Examples">Examples</h2>

<pre><code> sub dispatch_request {
   (
     # matches: GET /user/1.htm?show_details=1
     #          GET /user/1.htm
     &#39;GET + /user/* + ?show_details~ + .htm|.html|.xhtml&#39; =&gt; sub {
       my ($self, $user_id, $show_details) = @_;
       ...
     },
     # matches: POST /user?username=frew
     #          POST /user?username=mst&amp;first_name=matt&amp;last_name=trout
     &#39;POST + /user + ?username=&amp;*&#39; =&gt; sub {
        my ($self, $username, $misc_params) = @_;
       ...
     },
     # matches: DELETE /user/1/friend/2
     &#39;DELETE + /user/*/friend/*&#39; =&gt; sub {
       my ($self, $user_id, $friend_id) = @_;
       ...
     },
     # matches: PUT /user/1?first_name=Matt&amp;last_name=Trout
     &#39;PUT + /user/* + ?first_name~&amp;last_name~&#39; =&gt; sub {
       my ($self, $user_id, $first_name, $last_name) = @_;
       ...
     },
     &#39;/user/*/...&#39; =&gt; sub {
       my $user_id = $_[1];
       (
         # matches: PUT /user/1/role/1
         &#39;PUT + /role/*&#39; =&gt; sub {
           my $role_id = $_[1];
           ...
         },
         # matches: DELETE /user/1/role/1
         &#39;DELETE + /role/*&#39; =&gt; sub {
           my $role_id = $_[1];
           ...
         },
       );
     },
   );
 }</code></pre>

<h2 id="The-dispatch-cycle"><a id="The"></a>The dispatch cycle</h2>

<p>At the beginning of a request, your app&#39;s dispatch_request method is called with the PSGI $env as an argument. You can handle the request entirely in here and return a PSGI response arrayref if you want:</p>

<pre><code>  sub dispatch_request {
    my ($self, $env) = @_;
    [ 404, [ &#39;Content-type&#39; =&gt; &#39;text/plain&#39; ], [ &#39;Amnesia == fail&#39; ] ]
  }</code></pre>

<p>However, generally, instead of that, you return a set of route/target pairs:</p>

<pre><code>  sub dispatch_request {
    my $self = shift;
    (
      &#39;/&#39; =&gt; sub { redispatch_to &#39;/index.html&#39; },
      &#39;/user/*&#39; =&gt; sub { $self-&gt;show_user($_[1]) },
      &#39;POST + %*&#39; =&gt; &#39;handle_post&#39;,
      ...
    );
  }</code></pre>

<p>Well, a sub is a valid PSGI response too (for ultimate streaming and async cleverness). If you want to return a PSGI sub you have to wrap it into an array ref.</p>

<pre><code>  sub dispatch_request {
    [ sub {
        my $respond = shift;
        # This is pure PSGI here, so read perldoc PSGI
    } ]
  }</code></pre>

<p>If you return a string followed by a subroutine or method name, the string is treated as a match specification - and if the test is passed, the subroutine is called as a method and passed any matched arguments (see below for more details).</p>

<p>You can also return a plain subroutine which will be called with just <code>$env</code> - remember that in this case if you need <code>$self</code> you <b>must</b> close over it.</p>

<p>If you return a normal object, <a href="./Web::Simple.html">Web::Simple</a> will simply return it upwards on the assumption that a response_filter (or some arbitrary <a href="https://metacpan.org/pod/Plack::Middleware">Plack::Middleware</a>) somewhere will convert it to something useful. This allows:</p>

<pre><code>  sub dispatch_request {
    my $self = shift;
    (
      &#39;.html&#39; =&gt; sub { response_filter { $self-&gt;render_zoom($_[0]) } },
      &#39;/user/*&#39; =&gt; sub { $self-&gt;users-&gt;get($_[1]) },
    );
  }</code></pre>

<p>An alternative to using string + suborutine to declare a route is to use the sub prototype -</p>

<pre><code>  sub dispatch_request {
    my $self = shift;
    (
      sub (.html) { response_filter { $self-&gt;render_zoom($_[0]) } },
      sub (/user/) { $self-&gt;users-&gt;get($_[1]) },
      $self-&gt;can(&#39;handle_post&#39;), # if declared as &#39;sub handle_post (...) {&#39;
    )
  }</code></pre>

<p>This can be useful sugar, especially if you want to keep method-based dispatchers&#39; route specifications on the methods.</p>

<p>to render a user object to HTML, if there is an incoming URL such as:</p>

<pre><code>  http://myweb.org/user/111.html</code></pre>

<p>This works because as we descend down the dispachers, we first match <code>sub (.html)</code>, which adds a <code>response_filter</code> (basically a specialized routine that follows the <a href="https://metacpan.org/pod/Plack::Middleware">Plack::Middleware</a> specification), and then later we also match <code>sub (/user/*)</code> which gets a user and returns that as the response. This user object &#39;bubbles up&#39; through all the wrapping middleware until it hits the <code>response_filter</code> we defined, after which the return is converted to a true html response.</p>

<p>However, two types of objects are treated specially - a <code>Plack::Component</code> object will have its <code>to_app</code> method called and be used as a dispatcher:</p>

<pre><code>  sub dispatch_request {
    my $self = shift;
    (
      &#39;/static/...&#39; =&gt; sub { Plack::App::File-&gt;new(...) },
      ...
    );
  }</code></pre>

<p>A <a href="https://metacpan.org/pod/Plack::Middleware">Plack::Middleware</a> object will be used as a filter for the rest of the dispatch being returned into:</p>

<pre><code>  ## responds to /admin/track_usage AND /admin/delete_accounts

  sub dispatch_request {
    my $self = shift;
    (
      &#39;/admin/**&#39; =&gt; sub {
        Plack::Middleware::Session-&gt;new(%opts);
      },
      &#39;/admin/track_usage&#39; =&gt; sub {
        ## something that needs a session
      },
      &#39;/admin/delete_accounts&#39; =&gt; sub {
        ## something else that needs a session
      },
    );
  }</code></pre>

<p>Note that this is for the dispatch being <b>returned</b> to, so if you want to provide it inline you need to do:</p>

<pre><code>  ## ALSO responds to /admin/track_usage AND /admin/delete_accounts

  sub dispatch_request {
    my $self = shift;
    (
      &#39;/admin/...&#39; =&gt; sub {
        (
          sub {
            Plack::Middleware::Session-&gt;new(%opts);
          },
          &#39;/track_usage&#39; =&gt; sub {
            ## something that needs a session
          },
          &#39;/delete_accounts&#39; =&gt; sub {
            ## something else that needs a session
          },
        );
      }
    );
  }</code></pre>

<p>And that&#39;s it - but remember that all this happens recursively - it&#39;s dispatchers all the way down. A URL incoming pattern will run all matching dispatchers and then hit all added filters or <a href="https://metacpan.org/pod/Plack::Middleware">Plack::Middleware</a>.</p>

<h2 id="Web::Simple-match-specifications"><a id="Web"></a>Web::Simple match specifications</h2>

<h3 id="Method-matches"><a id="Method"></a>Method matches</h3>

<pre><code>  &#39;GET&#39; =&gt; sub {</code></pre>

<p>A match specification beginning with a capital letter matches HTTP requests with that request method.</p>

<h3 id="Path-matches"><a id="Path"></a>Path matches</h3>

<pre><code>  &#39;/login&#39; =&gt; sub {</code></pre>

<p>A match specification beginning with a / is a path match. In the simplest case it matches a specific path. To match a path with a wildcard part, you can do:</p>

<pre><code>  &#39;/user/*&#39; =&gt; sub {
    $self-&gt;handle_user($_[1])</code></pre>

<p>This will match /user/&lt;anything&gt; where &lt;anything&gt; does not include a literal / character. The matched part becomes part of the match arguments. You can also match more than one part:</p>

<pre><code>  &#39;/user/*/*&#39; =&gt; sub {
    my ($self, $user_1, $user_2) = @_;

  &#39;/domain/*/user/*&#39; =&gt; sub {
    my ($self, $domain, $user) = @_;</code></pre>

<p>and so on. To match an arbitrary number of parts, use <code>**</code>:</p>

<pre><code>  &#39;/page/**&#39; =&gt; sub {
    my ($self, $match) = @_;</code></pre>

<p>This will result in a single element for the entire match. Note that you can do</p>

<pre><code>  &#39;/page/**/edit&#39; =&gt; sub {</code></pre>

<p>to match an arbitrary number of parts up to but not including some final part.</p>

<p>Note: Since Web::Simple handles a concept of file extensions, <code>*</code> and <code>**</code> matchers will not by default match things after a final dot, and this can be modified by using <code>*.*</code> and <code>**.*</code> in the final position, e.g.:</p>

<pre><code>  /one/*       matches /one/two.three    and captures &quot;two&quot;
  /one/*.*     matches /one/two.three    and captures &quot;two.three&quot;
  /**          matches /one/two.three    and captures &quot;one/two&quot;
  /**.*        matches /one/two.three    and captures &quot;one/two.three&quot;</code></pre>

<p>Finally,</p>

<pre><code>  &#39;/foo/...&#39; =&gt; sub {</code></pre>

<p>Will match <code>/foo/</code> on the beginning of the path <b>and</b> strip it. This is designed to be used to construct nested dispatch structures, but can also prove useful for having e.g. an optional language specification at the start of a path.</p>

<p>Note that the &#39;...&#39; is a &quot;maybe something here, maybe not&quot; so the above specification will match like this:</p>

<pre><code>  /foo         # no match
  /foo/        # match and strip path to &#39;/&#39;
  /foo/bar/baz # match and strip path to &#39;/bar/baz&#39;</code></pre>

<p>Almost the same,</p>

<pre><code>  &#39;/foo...&#39; =&gt; sub {</code></pre>

<p>Will match on <code>/foo/bar/baz</code>, but also include <code>/foo</code>. Otherwise it operates the same way as <code>/foo/...</code>.</p>

<pre><code>  /foo         # match and strip path to &#39;&#39;
  /foo/        # match and strip path to &#39;/&#39;
  /foo/bar/baz # match and strip path to &#39;/bar/baz&#39;</code></pre>

<p>Please note the difference between <code>sub(/foo/...)</code> and <code>sub(/foo...)</code>. In the first case, this is expecting to find something after <code>/foo</code> (and fails to match if nothing is found), while in the second case we can match both <code>/foo</code> and <code>/foo/more/to/come</code>. The following are roughly the same:</p>

<pre><code>  &#39;/foo&#39;     =&gt; sub { &#39;I match /foo&#39; },
  &#39;/foo/...&#39; =&gt; sub {
    (
      &#39;/bar&#39; =&gt; sub { &#39;I match /foo/bar&#39; },
      &#39;/*&#39;   =&gt; sub { &#39;I match /foo/{id}&#39; },
    );
  }</code></pre>

<p>Versus</p>

<pre><code>  &#39;/foo...&#39; =&gt; sub {
    (
      &#39;~&#39;    =&gt; sub { &#39;I match /foo&#39; },
      &#39;/bar&#39; =&gt; sub { &#39;I match /foo/bar&#39; },
      &#39;/*&#39;   =&gt; sub { &#39;I match /foo/{id}&#39; },
    );
  }</code></pre>

<p>You may prefer the latter example should you wish to take advantage of subdispatchers to scope common activities. For example:</p>

<pre><code>  &#39;/user...&#39; =&gt; sub {
    my $user_rs = $schema-&gt;resultset(&#39;User&#39;);
    (
      &#39;~&#39; =&gt; sub { $user_rs },
      &#39;/*&#39; =&gt; sub { $user_rs-&gt;find($_[1]) },
    );
  }</code></pre>

<p>You should note the special case path match <code>sub (~)</code> which is only meaningful when it is contained in this type of path match. It matches to an empty path.</p>

<h4 id="Naming-your-patch-matches"><a id="Naming"></a>Naming your patch matches</h4>

<p>Any <code>*</code>, <code>**</code>, <code>*.*</code>, or <code>**.*</code> match can be followed with <code>:name</code> to make it into a named match, so:</p>

<pre><code>  &#39;/*:one/*:two/*:three/*:four&#39; =&gt; sub {
    &quot;I match /1/2/3/4 capturing { one =&gt; 1, two =&gt;  2, three =&gt; 3, four =&gt; 4 }&quot;
  }
  
  &#39;/**.*:allofit&#39; =&gt; sub {
    &quot;I match anything capturing { allofit =&gt; \$whole_path }&quot;
  }</code></pre>

<p>In the specific case of a simple single-* match, the * may be omitted, to allow you to write:</p>

<pre><code>  &#39;/:one/:two/:three/:four&#39; =&gt; sub {
    &quot;I match /1/2/3/4 capturing { one =&gt; 1, two =&gt;  2, three =&gt; 3, four =&gt; 4 }&quot;
  }</code></pre>

<h4 id="/foo-and-/foo/-are-different-specs"><a id="foo-and--foo--are-different-specs"></a><code>/foo</code> and <code>/foo/</code> are different specs</h4>

<p>As you may have noticed with the difference between <code>&#39;/foo/...&#39;</code> and <code>&#39;/foo...&#39;</code>, trailing slashes in path specs are significant. This is intentional and necessary to retain the ability to use relative links on websites. Let&#39;s demonstrate on this link:</p>

<pre><code>  &lt;a href=&quot;bar&quot;&gt;bar&lt;/a&gt;</code></pre>

<p>If the user loads the url <code>/foo/</code> and clicks on this link, they will be sent to <code>/foo/bar</code>. However when they are on the url <code>/foo</code> and click this link, then they will be sent to <code>/bar</code>.</p>

<p>This makes it necessary to be explicit about the trailing slash.</p>

<h3 id="Extension-matches"><a id="Extension"></a>Extension matches</h3>

<pre><code>  &#39;.html&#39; =&gt; sub {</code></pre>

<p>will match .html from the path (assuming the subroutine itself returns something, of course). This is normally used for rendering - e.g.:</p>

<pre><code>  &#39;.html&#39; =&gt; sub {
    response_filter { $self-&gt;render_html($_[1]) }
  }</code></pre>

<p>Additionally,</p>

<pre><code>  &#39;.*&#39; =&gt; sub {</code></pre>

<p>will match any extension and supplies the extension as a match argument.</p>

<h3 id="Query-and-body-parameter-matches"><a id="Query"></a>Query and body parameter matches</h3>

<p>Query and body parameters can be match via</p>

<pre><code>  &#39;?&lt;param spec&gt;&#39; =&gt; sub { # match URI query
  &#39;%&lt;param spec&gt;&#39; =&gt; sub { # match body params</code></pre>

<p>The body spec will match if the request content is either application/x-www-form-urlencoded or multipart/form-data - the latter of which is required for uploads - see below.</p>

<p>The param spec is elements of one of the following forms:</p>

<pre><code>  param~        # optional parameter
  param=        # required parameter
  @param~       # optional multiple parameter
  @param=       # required multiple parameter
  :param~       # optional parameter in hashref
  :param=       # required parameter in hashref
  :@param~      # optional multiple in hashref
  :@param=      # required multiple in hashref
  *             # include all other parameters in hashref
  @*            # include all other parameters as multiple in hashref</code></pre>

<p>separated by the <code>&amp;</code> character. The arguments added to the request are one per non-<code>:</code>/<code>*</code> parameter (scalar for normal, arrayref for multiple), plus if any <code>:</code>/<code>*</code> specs exist a hashref containing those values. If a parameter has no value, i.e. appears as &#39;?foo&amp;&#39;, a value of 1 will be captured.</p>

<p>Please note that if you specify a multiple type parameter match, you are ensured of getting an arrayref for the value, EVEN if the current incoming request has only one value. However if a parameter is specified as single and multiple values are found, the last one will be used.</p>

<p>For example to match a <code>page</code> parameter with an optional <code>order_by</code> parameter one would write:</p>

<pre><code>  &#39;?page=&amp;order_by~&#39; =&gt; sub {
    my ($self, $page, $order_by) = @_;
    return unless $page =~ /^\d+$/;
    $order_by ||= &#39;id&#39;;
    response_filter {
      $_[1]-&gt;search_rs({}, { page =&gt; $page, order_by =&gt; $order_by });
    }
  }</code></pre>

<p>to implement paging and ordering against a <a href="https://metacpan.org/pod/DBIx::Class::ResultSet">DBIx::Class::ResultSet</a> object.</p>

<p>Another Example: To get all parameters as a hashref of arrayrefs, write:</p>

<pre><code>  &#39;?@*&#39; =&gt; sub {
    my ($self, $params) = @_;
    ...</code></pre>

<p>To get two parameters as a hashref, write:</p>

<pre><code>  &#39;?:user~&amp;:domain~&#39; =&gt; sub {
    my ($self, $params) = @_; # params contains only &#39;user&#39; and &#39;domain&#39; keys</code></pre>

<p>You can also mix these, so:</p>

<pre><code>  &#39;?foo=&amp;@bar~&amp;:coffee=&amp;@*&#39; =&gt; sub {
     my ($self, $foo, $bar, $params) = @_;</code></pre>

<p>where $bar is an arrayref (possibly an empty one), and $params contains arrayref values for all parameters <b>not</b> mentioned and a scalar value for the &#39;coffee&#39; parameter.</p>

<p>Note, in the case where you combine arrayref, single parameter and named hashref style, the arrayref and single parameters will appear in <code>@_</code> in the order you defined them in the prototype, but all hashrefs will merge into a single <code>$params</code>, as in the example above.</p>

<h3 id="Upload-matches"><a id="Upload"></a>Upload matches</h3>

<pre><code>  &#39;*foo=&#39; =&gt; sub { # param specifier can be anything valid for query or body</code></pre>

<p>The upload match system functions exactly like a query/body match, except that the values returned (if any) are <code>Web::Dispatch::Upload</code> objects.</p>

<p>Note that this match type will succeed in two circumstances where you might not expect it to - first, when the field exists but is not an upload field and second, when the field exists but the form is not an upload form (i.e. content type &quot;application/x-www-form-urlencoded&quot; rather than &quot;multipart/form-data&quot;). In either of these cases, what you&#39;ll get back is a <code>Web::Dispatch::NotAnUpload</code> object, which will <code>die</code> with an error pointing out the problem if you try and use it. To be sure you have a real upload object, call</p>

<pre><code>  $upload-&gt;is_upload # returns 1 on a valid upload, 0 on a non-upload field</code></pre>

<p>and to get the reason why such an object is not an upload, call</p>

<pre><code>  $upload-&gt;reason # returns a reason or &#39;&#39; on a valid upload.</code></pre>

<p>Other than these two methods, the upload object provides the same interface as <a href="https://metacpan.org/pod/Plack::Request::Upload">Plack::Request::Upload</a> with the addition of a stringify to the temporary filename to make copying it somewhere else easier to handle.</p>

<h3 id="Combining-matches"><a id="Combining"></a>Combining matches</h3>

<p>Matches may be combined with the + character - e.g.</p>

<pre><code>  &#39;GET + /user/*&#39; =&gt; sub {</code></pre>

<p>to create an AND match. They may also be combined with the | character - e.g.</p>

<pre><code>  &#39;GET|POST&#39; =&gt; sub {</code></pre>

<p>to create an OR match. Matches can be nested with () - e.g.</p>

<pre><code>  &#39;(GET|POST + /user/*)&#39; =&gt; sub {</code></pre>

<p>and negated with ! - e.g.</p>

<pre><code>  &#39;!/user/foo + /user/*&#39; =&gt; sub {</code></pre>

<p>! binds to the immediate rightmost match specification, so if you want to negate a combination you will need to use</p>

<pre><code>  &#39;!(POST|PUT|DELETE)&#39; =&gt; sub {</code></pre>

<p>and | binds tighter than +, so</p>

<pre><code>  &#39;(GET|POST) + /user/*&#39; =&gt; sub {</code></pre>

<p>and</p>

<pre><code>  &#39;GET|POST + /user/*&#39; =&gt; sub {</code></pre>

<p>are equivalent, but</p>

<pre><code>  &#39;(GET + /admin/...) | (POST + /admin/...)&#39; =&gt; sub {</code></pre>

<p>and</p>

<pre><code>  &#39;GET + /admin/... | POST + /admin/...&#39; =&gt; sub {</code></pre>

<p>are not - the latter is equivalent to</p>

<pre><code>  &#39;GET + (/admin/...|POST) + /admin/...&#39; =&gt; sub {</code></pre>

<p>which will never match!</p>

<h3 id="Whitespace">Whitespace</h3>

<p>Note that for legibility you are permitted to use whitespace:</p>

<pre><code>  &#39;GET + /user/*&#39; =&gt; sub {</code></pre>

<p>but it will be ignored. This is because the perl parser strips whitespace from subroutine prototypes, so this is equivalent to</p>

<pre><code>  &#39;GET+/user/*&#39; =&gt; sub {</code></pre>

<h3 id="Accessing-parameters-via-%_"><a id="Accessing"></a><a id="Accessing-parameters-via--_"></a>Accessing parameters via <code>%_</code></h3>

<p>If your dispatch specification causes your dispatch subroutine to receive a hash reference as its first argument, the contained named parameters will be accessible via <code>%_</code>.</p>

<p>This can be used to access your path matches, if they are named:</p>

<pre><code>  &#39;GET + /foo/:path_part&#39; =&gt; sub {
    [ 200,
      [&#39;Content-type&#39; =&gt; &#39;text/plain&#39;],
      [&quot;We are in $_{path_part}&quot;],
    ];
  }</code></pre>

<p>Or, if your first argument would be a hash reference containing named query parameters:</p>

<pre><code>  &#39;GET + /foo + ?:some_param=&#39; =&gt; sub {
    [ 200,
      [&#39;Content-type&#39; =&gt; &#39;text/plain&#39;],
      [&quot;We received $_{some_param} as parameter&quot;],
    ];
  }</code></pre>

<p>Of course this also works when all you are doing is slurping the whole set of parameters by their name:</p>

<pre><code>  &#39;GET + /foo + ?*&#39; =&gt; sub {
    [ 200,
      [&#39;Content-type&#39; =&gt; &#39;text/plain&#39;],
      [exists($_{foo}) ? &quot;Received a foo: $_{foo}&quot; : &quot;No foo!&quot;],
    ],
  }</code></pre>

<p>Note that only the first hash reference will be available via <code>%_</code>. If you receive additional hash references, you will need to access them as usual.</p>

<h3 id="Accessing-the-PSGI-env-hash"><a id="Accessing1"></a>Accessing the PSGI env hash</h3>

<p>In some cases you may wish to get the raw PSGI env hash - to do this, you can either use a plain sub:</p>

<pre><code>  sub {
    my ($env) = @_;
    ...
  }</code></pre>

<p>or use the <code>PSGI_ENV</code> constant exported to retrieve it from <code>@_</code>:</p>

<pre><code>  &#39;GET + /foo + ?some_param=&#39; =&gt; sub {
    my $param = $_[1];
    my $env = $_[PSGI_ENV];
  }</code></pre>

<p>but note that if you&#39;re trying to add a middleware, you should simply use Web::Simple&#39;s direct support for doing so.</p>

<h1 id="EXPORTED-SUBROUTINES"><a id="EXPORTED"></a>EXPORTED SUBROUTINES</h1>

<h2 id="response_filter">response_filter</h2>

<pre><code>  response_filter {
    # Hide errors from the user because we hates them, preciousss
    if (ref($_[0]) eq &#39;ARRAY&#39; &amp;&amp; $_[0]-&gt;[0] == 500) {
      $_[0] = [ 200, @{$_[0]}[1..$#{$_[0]}] ];
    }
    return $_[0];
  };</code></pre>

<p>The response_filter subroutine is designed for use inside dispatch subroutines.</p>

<p>It creates and returns a special dispatcher that always matches, and calls the block passed to it as a filter on the result of running the rest of the current dispatch chain.</p>

<p>Thus the filter above runs further dispatch as normal, but if the result of dispatch is a 500 (Internal Server Error) response, changes this to a 200 (OK) response without altering the headers or body.</p>

<h2 id="redispatch_to">redispatch_to</h2>

<pre><code>  redispatch_to &#39;/other/url&#39;;</code></pre>

<p>The redispatch_to subroutine is designed for use inside dispatch subroutines.</p>

<p>It creates and returns a special dispatcher that always matches, and instead of continuing dispatch re-delegates it to the start of the dispatch process, but with the path of the request altered to the supplied URL.</p>

<p>Thus if you receive a POST to <code>/some/url</code> and return a redispatch to <code>/other/url</code>, the dispatch behaviour will be exactly as if the same POST request had been made to <code>/other/url</code> instead.</p>

<p>Note, this is not the same as returning an HTTP 3xx redirect as a response; rather it is a much more efficient internal process.</p>

<h1 id="CHANGES-BETWEEN-RELEASES"><a id="CHANGES"></a>CHANGES BETWEEN RELEASES</h1>

<h2 id="Changes-between-0.004-and-0.005"><a id="Changes"></a>Changes between 0.004 and 0.005</h2>

<ul>

<li><p>dispatch {} replaced by declaring a dispatch_request method</p>

<p>dispatch {} has gone away - instead, you write:</p>

<pre><code>  sub dispatch_request {
    my $self = shift;
    (
      &#39;GET /foo/&#39; =&gt; sub { ... },
      ...
    );
  }</code></pre>

<p>Note that this method is still <b>returning</b> the dispatch code - just like <code>dispatch</code> did.</p>

<p>Also note that you need the <code>my $self = shift</code> since the magic $self variable went away.</p>

</li>
<li><p>the magic $self variable went away.</p>

<p>Just add <code>my $self = shift;</code> while writing your <code>sub dispatch_request {</code> like a normal perl method.</p>

</li>
<li><p>subdispatch deleted - all dispatchers can now subdispatch</p>

<p>In earlier releases you needed to write:</p>

<pre><code>  subdispatch sub (/foo/...) {
    ...
    [
      sub (GET /bar/) { ... },
      ...
    ]
  }</code></pre>

<p>As of 0.005, you can instead write simply:</p>

<pre><code>  sub (/foo/...) {
    ...
    (
      sub (GET /bar/) { ... },
      ...
    )
  }</code></pre>

</li>
</ul>

<h2 id="Changes-since-Antiquated-Perl"><a id="Changes1"></a>Changes since Antiquated Perl</h2>

<ul>

<li><p>filter_response renamed to response_filter</p>

<p>This is a pure rename; a global search and replace should fix it.</p>

</li>
<li><p>dispatch [] changed to dispatch {}</p>

<p>Simply changing</p>

<pre><code>  dispatch [ sub(...) { ... }, ... ];</code></pre>

<p>to</p>

<pre><code>  dispatch { sub(...) { ... }, ... };</code></pre>

<p>should work fine.</p>

</li>
</ul>

<h1 id="DEVELOPMENT-HISTORY"><a id="DEVELOPMENT"></a>DEVELOPMENT HISTORY</h1>

<p>Web::Simple was originally written to form part of my Antiquated Perl talk for Italian Perl Workshop 2009, but in writing the bloggery example I realised that having a bare minimum system for writing web applications that doesn&#39;t drive me insane was rather nice and decided to spend my attempt at nanowrimo for 2009 improving and documenting it to the point where others could use it.</p>

<p>The Antiquated Perl talk can be found at <a href="http://www.shadowcat.co.uk/archive/conference-video/">http://www.shadowcat.co.uk/archive/conference-video/</a> and the slides are reproduced in this distribution under <a href="https://metacpan.org/pod/distribution/Web-Simple/lib/Web/Simple/AntiquatedPerl.pod">Web::Simple::AntiquatedPerl</a>.</p>

<h1 id="COMMUNITY-AND-SUPPORT"><a id="COMMUNITY"></a>COMMUNITY AND SUPPORT</h1>

<h2 id="IRC-channel"><a id="IRC"></a>IRC channel</h2>

<p>irc.perl.org #web-simple</p>

<h2 id="No-mailing-list-yet"><a id="No"></a>No mailing list yet</h2>

<p>Because mst&#39;s non-work email is a bombsite so he&#39;d never read it anyway.</p>

<h2 id="Git-repository"><a id="Git"></a>Git repository</h2>

<p>Gitweb is on http://git.shadowcat.co.uk/ and the clone URL is:</p>

<pre><code>  git clone git://git.shadowcat.co.uk/catagits/Web-Simple.git</code></pre>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Matt S. Trout (mst) &lt;mst@shadowcat.co.uk&gt;</p>

<h1 id="CONTRIBUTORS">CONTRIBUTORS</h1>

<p>Devin Austin (dhoss) &lt;dhoss@cpan.org&gt;</p>

<p>Arthur Axel &#39;fREW&#39; Schmidt &lt;frioux@gmail.com&gt;</p>

<p>gregor herrmann (gregoa) &lt;gregoa@debian.org&gt;</p>

<p>John Napiorkowski (jnap) &lt;jjn1056@yahoo.com&gt;</p>

<p>Josh McMichael &lt;jmcmicha@linus222.gsc.wustl.edu&gt;</p>

<p>Justin Hunter (arcanez) &lt;justin.d.hunter@gmail.com&gt;</p>

<p>Kjetil Kjernsmo &lt;kjetil@kjernsmo.net&gt;</p>

<p>markie &lt;markie@nulletch64.dreamhost.com&gt;</p>

<p>Christian Walde (Mithaldu) &lt;walde.christian@googlemail.com&gt;</p>

<p>nperez &lt;nperez@cpan.org&gt;</p>

<p>Robin Edwards &lt;robin.ge@gmail.com&gt;</p>

<p>Andrew Rodland (hobbs) &lt;andrew@cleverdomain.org&gt;</p>

<p>Robert Sedlacek (phaylon) &lt;r.sedlacek@shadowcat.co.uk&gt;</p>

<p>Hakim Cassimally (osfameron) &lt;osfameron@cpan.org&gt;</p>

<p>Karen Etheridge (ether) &lt;ether@cpan.org&gt;</p>

<h1 id="COPYRIGHT">COPYRIGHT</h1>

<p>Copyright (c) 2011 the Web::Simple <a href="./Web::Simple.html#AUTHOR">&quot;AUTHOR&quot;</a> and <a href="./Web::Simple.html#CONTRIBUTORS">&quot;CONTRIBUTORS&quot;</a> as listed above.</p>

<h1 id="LICENSE">LICENSE</h1>

<p>This library is free software and may be distributed under the same terms as perl itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Web::Simple, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Web::Simple</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Web::Simple</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Web::Simple.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
